import time
def metric(fn):
    def Running_time(*args,**kw):
        start_time = time.time()
        #运行函数
        FUNC = fn(*args,**kw)
        end_time = time.time()
        print('耗时：{:.4f}s'.format(end_time - start_time))
        return FUNC
    return Running_time


#测试代码
def test(a,b):
    print(a,b)
    print('test is running')

f = metric(test)
f(1,2)